var qr = require('qr-image');
var path = require('path');
const fs = require('fs');
var qrSvg = qr.image('I love QR!', { type: 'png' });
qrSvg.pipe(require('fs').createWriteStream('img/i_love_qr.png'));
// eslint-disable-next-line no-undef
const filePath = path.join(__dirname, '/upload/');
console.log(filePath);
mkdirSync(filePath);
/**
 * 生成目录
 * @returns {boolean}
 */
// eslint-disable-next-line consistent-return,strict
function mkdirSync(dirname) {
  if (fs.existsSync(dirname)) {
    return true;
  } else {
    if (mkdirSync(path.dirname(dirname))) {
      fs.mkdirSync(dirname);
      return true;
    }
  }
}
